import { IPSAppView } from '../app/view/ipsapp-view';
import { IPSDEServiceAPI } from '../dataentity/service/ipsdeservice-api';
import { IPSDEServiceAPIMethod } from '../dataentity/service/ipsdeservice-apimethod';
import { IPSAppViewTestCase } from './ipsapp-view-test-case';
import { IPSDESAMethodTestCase } from './ipsdesamethod-test-case';
import { IPSSysTestModule } from './ipssys-test-module';
import { IPSSysTestPrj } from './ipssys-test-prj';
import { PSSysTestCaseImpl } from './pssys-test-case-impl';

export class PSSysTestCase2Impl extends PSSysTestCaseImpl implements IPSDESAMethodTestCase, IPSAppViewTestCase {
  protected psappview: IPSAppView | null = null;

  getPSAppView(): IPSAppView | null {
    if (this.psappview != null) return this.psappview;
    const value = this.M.getPSAppView;
    if (value == null) {
      return null;
    }
    this.psappview = this.getPSSysTestPrjMust().getPSApplicationMust().findPSAppView(value);
    return this.psappview;
  }

  get psAppView(): IPSAppView | null {
    return this.getPSAppView();
  }

  getPSAppViewMust(): IPSAppView {
    const value = this.getPSAppView();
    if (value == null) {
      throw new Error('未指定应用视图');
    }
    return value;
  }

  protected psdeserviceapi: IPSDEServiceAPI | null = null;

  getPSDEServiceAPI(): IPSDEServiceAPI | null {
    if (this.psdeserviceapi != null) return this.psdeserviceapi;
    const value = this.M.getPSDEServiceAPI;
    if (value == null) {
      return null;
    }
    this.psdeserviceapi = this.getPSSysTestPrjMust().getPSSysServiceAPIMust().findPSDEServiceAPI(value);
    return this.psdeserviceapi;
  }

  get psDEServiceAPI(): IPSDEServiceAPI | null {
    return this.getPSDEServiceAPI();
  }

  getPSDEServiceAPIMust(): IPSDEServiceAPI {
    const value = this.getPSDEServiceAPI();
    if (value == null) {
      throw new Error('未指定实体服务接口');
    }
    return value;
  }

  protected psdeserviceapimethod: IPSDEServiceAPIMethod | null = null;

  getPSDEServiceAPIMethod(): IPSDEServiceAPIMethod | null {
    if (this.psdeserviceapimethod != null) return this.psdeserviceapimethod;
    const value = this.M.getPSDEServiceAPIMethod;
    if (value == null) {
      return null;
    }
    this.psdeserviceapimethod = this.getPSDEServiceAPIMust().findPSDEServiceAPIMethod(value);
    return this.psdeserviceapimethod;
  }

  get psDEServiceAPIMethod(): IPSDEServiceAPIMethod | null {
    return this.getPSDEServiceAPIMethod();
  }

  getPSDEServiceAPIMethodMust(): IPSDEServiceAPIMethod {
    const value = this.getPSDEServiceAPIMethod();
    if (value == null) {
      throw new Error('未指定实体服务接口方法');
    }
    return value;
  }

  protected pssystestmodule: IPSSysTestModule | null = null;

  getPSSysTestModule(): IPSSysTestModule | null {
    if (this.pssystestmodule != null) return this.pssystestmodule;
    const value = this.M.getPSSysTestModule;
    if (value == null) {
      return null;
    }
    this.pssystestmodule = this.getPSSysTestPrjMust().findPSSysTestModule(value);
    return this.pssystestmodule;
  }

  get psSysTestModule(): IPSSysTestModule | null {
    return this.getPSSysTestModule();
  }

  getPSSysTestModuleMust(): IPSSysTestModule {
    const value = this.getPSSysTestModule();
    if (value == null) {
      throw new Error('未指定测试模块');
    }
    return value;
  }

  protected pssystestprj: IPSSysTestPrj | null = null;

  getPSSysTestPrj(): IPSSysTestPrj | null {
    if (this.pssystestprj != null) return this.pssystestprj;
    const value = this.M.getPSSysTestPrj;
    if (value == null) {
      return null;
    }
    this.pssystestprj = this.getPSModel4('testing.IPSSysTestPrj', value, 'getPSSysTestPrj') as IPSSysTestPrj;
    return this.pssystestprj;
  }

  get psSysTestPrj(): IPSSysTestPrj | null {
    return this.getPSSysTestPrj();
  }

  getPSSysTestPrjMust(): IPSSysTestPrj {
    const value = this.getPSSysTestPrj();
    if (value == null) {
      throw new Error('未指定测试项目');
    }
    return value;
  }

  get cls(): string {
    return 'PSSysTestCase2Impl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'testing.IPSAppViewTestCase' || cls == 'testing.IPSDESAMethodTestCase' || cls == 'testing.IPSSysTestCase2') return true;
    return super.instanceof(cls);
  }
}
